package com.hqyj.springboot.modules.account.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hqyj.springboot.modules.common.entity.AbstractEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.List;

@Entity
@Table(name = "test_resource")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Resource extends AbstractEntity {
    private String permition;
    @ManyToMany(cascade = CascadeType.ALL,fetch = FetchType.EAGER)
    @JoinTable(name = "test_role_resource",
    joinColumns = @JoinColumn(name = "resource_id",unique = true),
    inverseJoinColumns = @JoinColumn(name = "role_id",unique = true))
    @JsonIgnore
    private List<Role> roles;




}
